//
//  CycStatusBottomView.swift
//  微博cyc
//
//  Created by cyc on 16/3/5.
//  Copyright © 2016年 cyc. All rights reserved.
//

import UIKit
//自定义CycStatusBottomView
//设置转发和收藏评论的view
class CycStatusBottomView: UIView
    
{  required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        prepareUI()
    }
    
    private func prepareUI() {
        // 添加子控件
        addSubview(forwardButton)
        addSubview(commentButton)
        addSubview(likeButton)
        addSubview(separatorViewFirst)
        addSubview(separatorViewSecond)
        
        // 添加约束
        // 按钮平铺
        let multipliedBy = 1 / 3.0
        // 转发
        forwardButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(multipliedBy)
        }
        
        // 评论
        commentButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(forwardButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(multipliedBy)
        }
        
        // 赞
        likeButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(commentButton.snp_trailing)
            make.top.trailing.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(multipliedBy)
        }
        
        // 分割线1
        separatorViewFirst.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(forwardButton.snp_trailing)
            make.centerY.equalTo(forwardButton)
        }
        
        // 分割线2
        separatorViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentButton.snp_trailing)
            make.centerY.equalTo(commentButton)
        }
    }
    
    // MARK: - 懒加载
    // 转发按钮
    private lazy var forwardButton: UIButton = UIButton(imageName: "timeline_icon_retweet", bkgImageName: "timeline_card_bottom_background", title: "转发", font: 11)
    
    // 评论
    private lazy var commentButton: UIButton = UIButton(imageName: "timeline_icon_comment", bkgImageName: "timeline_card_bottom_background", title: "评论")
    
    // 赞
    private lazy var likeButton: UIButton = UIButton(imageName: "timeline_icon_unlike", title: "赞")
    
    // 分割线1
    private lazy var separatorViewFirst: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    private lazy var separatorViewSecond: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))    ////在 5.CZStatusCell 懒加载 bottomView
    //private lazy var bpttomView:CycStatusBottomView=CycStatusBottomView()

    
    

    

}
//抽取代码
private func chaouqu(){
    //        //2，设置背景图片
    //        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
    //        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
    //
    //        //设置图片
    //        button.setImage(UIImage(named: "timeline_card_bottom_line"), forState: UIControlState.Normal)
    //        //设置标题内容和大小颜色
    //        button.setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
    //        button.setTitle("转发", forState: UIControlState.Normal)
    //        button.titleLabel?.font = UIFont.systemFontOfSize(12)
    //3.设置约束
    
    //        return button
    //    }()
    
}
//1设置buttom的属性之后抽取button的在扩展创建CycUIButtond+Extension
 //// 2MARK: - 5构造函数
/// 3 MARK: - 准备UI
//4 在 CZStatusCell 懒加载 bottomView
/////5 底部视图